﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BrokerBase.Lib.Policy;

namespace broker.duty.SM
{
    class Class19
    {
        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("疾病身故"))
            {
                double m1 = ppa.GetDutyTotalValue("长期护理疗养保险");
                double m2 = ppa.GetDutyTotalValue("长期护理保险");
                da.Value = ppa.Amount-m1-m2;
                ppa.IsCurrentFinish = true;

            }
        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("长期护理"))
            {
                double m1 = ppa.GetDutyTotalValue("长期护理疗养保险");

                if (m1 <= double.Epsilon)
                {
                    da.Value = ppa.Amount * 0.2;
                }

            }
        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("长期护理"))
            {

                double m1 = ppa.GetDutyTotalValue("长期护理保险");

                double m = ppa.Amount * 0.16;

                if ((m + m1) > (ppa.Amount * 0.8))
                {
                    da.Value = m;
                }
                else
                {
                    da.Value = ppa.Amount * 0.8 - m1;
                    ppa.IsCurrentFinish = true;
                }

                ppa.Fee = 0;
            }
        }
    }
}
